<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="../common.jsp" %>
<%@ taglib prefix="ui" uri="http://com.am.tag"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'registerEdit.jsp' starting page</title>
	<style type="text/css">
		*{
			font-size: 12px;
		}
	</style>
	<script>
	
		function doSave()
    	{
			if(doCheck())
			{
				var map = Form.formToBean("winForm");
		 		ajax.remoteCall("com.system.dao.RegisterDao:updatePrivate",[map],function(reply){
		 			var result = reply.getResult();
		 			alert(result.value);
		 			if(result.type == "success")
		 			{
		 				var dlg = Dialog.getInstance("view");
		 	    		dlg.getParam("window").mygrid.reload();
		 	    		dlg.close();
		 			}
		 		});
			}
    	}

		function doCheck()
		{
			if($.trim($("#register_name").val())==""){
				alert("请输入病人姓名再挂号");
				return false;
			}
			
			if(!check_integer($.trim($("#book_amount").val())))
			{
				alert("病历本费用必须是数字");
				return false;
			}
			
			if($.trim($("#registerCost").val()) == "" || !check_integer($.trim($("#registerCost").val())))
			{
				alert("挂号费不能为空且必须是数字");
				return false;
			}
			
			return true;
		}
    	
    	function count(){
			
    		
    		if($.trim($("#book_amount").val()) != ""){
    			var amount = parseInt($("#registerCost").val()) + parseInt($("#book_amount").val());
    		}else{
    			var amount = parseInt($("#registerCost").val());
    		}
			
			if(isNaN(amount))
			{
				$("#total").val();
			}else{
				$("#total").val(amount);
			}
		}
	</script>
  </head>
  
  <body style="overflow: hidden;">
   <form id="winForm" name="winForm">
   		<input id="currentUserName" name="currentUserName" type="hidden" value="${currentUserName}">
   		<input id="create_user_id" name="create_user_id" type="hidden" value="${currentUserId}">
   		<input id="currentUserCampus" name="currentUserCampus" type="hidden" value="${currentUserCampus}">
				<table border="0" cellpadding="0" cellspacing="0" width="610" align="left">
					<tr>
						<td>
							<fieldset>
								<legend><font color='#3A5FCD' size='2'><b>基本信息</b></font></legend>
								<table border="0" cellpadding="0" cellspacing="0">
									<tr>
										<td height="40" width="200" valign="middle" align="center">
											<font style="margin-left:0.6cm;">姓名：</font>
											<input name="register_name" id="register_name" class="textbox" style="width:120px;" />
										</td>
										<td height="40" width="220" valign="middle" align="center">
											<font style="margin-right:0.1cm;">性别：</font>
											<input name="sex" type="radio" value="男" checked/><font style="margin-right:0.5cm;margin-left:5px;">男</font>
											<input name="sex" type="radio" value="女"/>女
										</td>
										<td height="40" width="200" valign="middle" align="center">
											地址：<input name="address" id="address" class="textbox" style="width:120px" />
										</td>
									</tr>
									<tr>
										<td height="40" width="200" valign="middle" align="center">
											出生年月：<ui:DateTimePicker id="birthday" name="birthday" dateFormat="yyyy-MM-dd"></ui:DateTimePicker>
										</td>
										<td height="40" width="260" valign="middle" align="center">
											<span style="margin-left:15px;">证件号：</span>
											<input name="IDnumber" id="IDnumber" class="textbox" style="width:140px" />
										</td>
									</tr>
								</table>
							</fieldset>
						</td>
					</tr>
					<tr>
						<td>
							<fieldset>
								<legend><font color='#3A5FCD' size='2'><b>详细信息</b></font></legend>
								<table>
									<tr>
										<td height="50" width="200" valign="middle" align="center">
											电话号码：<input name="telephone" id="telephone" class="textbox" style="width:120px" />
										</td>
										<td height="50" width="200" valign="middle" align="center" colspan="3">
											病人类型：<input name="patientType" id="patientType" class="textbox" value="其他" readonly="readonly" style="width:140px" />
										</td>
									</tr>
								</table>
							</fieldset>
						</td>
					</tr>
					<tr>
						<td>
							<fieldset>
								<legend><font color='#3A5FCD' size='2'><b>费用小计</b></font></legend>
								<table>
									<tr>
										<td height="60" width="200" valign="middle" align="center">
											&nbsp;&nbsp;&nbsp;&nbsp;挂号费：<input name="registerCost" id="registerCost" class="textbox" style="width:120px" onkeyup="count()"/>
										</td>
										<td height="60" width="200" valign="middle" align="center">
											&nbsp;&nbsp;&nbsp;&nbsp;病历本：<input name="book_amount" id="book_amount" onkeyup="count()" class="textbox" style="width:120px" />
										</td>
										<td height="60" width="200" valign="middle" align="center">
											小计：<input name="total" id="total" class="textbox" style="width:120px" />
										</td>
									</tr>
								</table>
							</fieldset>
						</td>
					</tr>
				</table>
	</form>
  </body>
</html>
